//
//  Global.m
//  newFinding
//
//  Created by Shin Stupid on 7/26/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "Global.h"
static int MapChoiced=-1;
static int ChapterChoiced=1;
//static int numberRandom=213;
static int UsingArray=1;
static int nextMap=0;
#define Array_1 [NSMutableArray arrayWithObjects: @"4",@"2",@"3",@"1",@"5",nil];
#define Array_2 [NSMutableArray arrayWithObjects: @"2",@"1",@"5",@"4",@"3",nil];
#define Array_3 [NSMutableArray arrayWithObjects: @"5",@"3",@"1",@"2",@"4",nil];
#define Array_4 [NSMutableArray arrayWithObjects: @"4",@"5",@"3",@"1",@"2",nil];
#define Array_5 [NSMutableArray arrayWithObjects: @"3",@"5",@"2",@"3",@"2",nil];
#define Array_6 [NSMutableArray arrayWithObjects: @"2",@"3",@"5",@"4",@"1",nil];
#define Array_7 [NSMutableArray arrayWithObjects: @"4",@"1",@"2",@"3",@"5",nil];
#define Array_8 [NSMutableArray arrayWithObjects: @"2",@"5",@"1",@"3",@"4",nil];
#define Array_9 [NSMutableArray arrayWithObjects: @"5",@"1",@"2",@"4",@"3",nil];
#define Array_10 [NSMutableArray arrayWithObjects: @"1",@"3",@"2",@"5",@"4",nil];
@implementation Global
+(void)setMapChoiced:(int)value //// map chon truc tiep khi choi truc tiep
{
    MapChoiced=value;
}
+(int)getMapChoice
{
    return MapChoiced;
}
+(void)setChapterChoiced:(int)value
{
    ChapterChoiced=value;
}
+(int)getChapterChoiced
{
    return ChapterChoiced;
}
+(CGPoint)PositionWithInt:(int)iValue
{
    switch (iValue) {
        case 0:
             return CGPointMake(200,250);///470
            break;
        case 1:
            return CGPointMake(720,250);//
            break;
        case 2:
            return CGPointMake(200,470);///
            break;
        case 3:
            return CGPointMake(720,470);
            break;
        case 4:
            return CGPointMake(460,320);///
            break;
        default:
            break;
    }
    
    return CGPointMake(0, 0);
}
BOOL isInsidePointOnRect( CGRect rect, CGPoint check_pt )
{
	BOOL ret = NO;
	
	if( (rect.origin.x <= check_pt.x)
	   && ((rect.origin.x+rect.size.width ) >= check_pt.x)
	   && ( rect.origin.y                   <= check_pt.y)
	   && ((rect.origin.y+rect.size.height) >= check_pt.y)
	   )
	{
		ret = YES;
        NSLog(@"is Touch Inside");
	}
	return ret;
}
+(void)setRandomListMap
{
  
    int random=arc4random()%10+1;
    if(random>10||random<1)
    {
        random=10;
    }
    UsingArray=random;
    nextMap=0;
    
    
}
+(void)setNextMap
{
    nextMap++;
}
+(int)getMapInChapter
{
    
    switch (UsingArray) {
        case 1:
        { 
            NSArray *tempArray= Array_1;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
        }           
            break;
        case 2:
        {
                NSArray *tempArray= Array_2;
                NSString *Str=[tempArray objectAtIndex:nextMap];
                int value=[Str intValue];
                return value;            
        }
            break;
        case 3:
        {
            
            NSArray *tempArray= Array_3;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
        case 4:
        {
            
            NSArray *tempArray= Array_4;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
        case 5:
        {
            
            NSArray *tempArray= Array_5;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
        case 6:
        {
            
            NSArray *tempArray= Array_6;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
        case 7:
        {
            
            NSArray *tempArray= Array_7;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
        case 8:
        {
            
            NSArray *tempArray= Array_8;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
        case 9:
        {
            
            NSArray *tempArray= Array_9;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
        case 10:
        {
            
            NSArray *tempArray= Array_10;
            NSString *Str=[tempArray objectAtIndex:nextMap];
            int value=[Str intValue];
            return value;
            
        }
            break;
            
        default:
            break;
    }
    
    return nextMap;
}
@end
